<?php

function usercode_loyalty_settings() {
	$form['base_return_of_money'] = array(
		'#type' => 'textfield',
		'#title' => t('Base "return of money" percentage'),
		'#default_value' => variable_get('base_return_of_money', 3),
		'#description' => t('Enter the base percentage for "return of money". This applies to all the users.'),
		'#field_suffix' => '%',
		'#size' => 3,
	);
	$role_ids = array(CLIENT_ROLE_ID => t('Client'), SILVER_ROLE_ID => t('Silver'), GOLD_ROLE_ID => t('Gold'));
	foreach ($role_ids as $key => $value){
		$form['return_of_money_role_'.$key] = array(
			'#type' => 'textfield',
			'#title' => t('Additional "return of money" percentage for @role role', array('@role' => $value)),
			'#default_value' => variable_get('return_of_money_role_'.$key, 1),
			'#field_suffix' => '%',
			'#size' => 3,
		);
	}
	foreach ($role_ids as $key => $value){
		$form['treshold_for_role_'.$key] = array(
			'#type' => 'textfield',
			'#title' => t('Treshold to become a @role user', array('@role' => $value)),
			'#default_value' => variable_get('treshold_for_role_'.$key, 10000),
			'#size' => 10,
		);
	}
	return system_settings_form($form);
}

/**
 * @todo implement it.
 *
 */
function usercode_loyalty_settings_validate($form, &$form_state){
	
}